<include file="../Public/_store_header"/>

<block name="script">
    <script src="__JS__/payfor/payfor.js" type="text/javascript"></script>
    <link rel="stylesheet" href="__JS__/jqzoom/jqzoom.css" type="text/css">
    <link rel="stylesheet" href="__JS__/payfor/payfor.css" type="text/css">
    <script src="__JS__/jqzoom/jqzoom.js" type="text/javascript"></script>


</block>


<style>


    h2 {
        padding-left: 10px;
        font-size: 14px;
        font-weight: normal;
    }

    .store_det li {
        width: auto;
    }

    .pic_size {
        width: 100px !important;
        height: 100px !important;

    }
</style>
<div class="col-xs-12">
    <div class="common_block_border" style="">
        <div class="pull-left"><a href="{:U('store/shop/detail',array('id'=>$shop['id']))}"
                                  style="font-size: 16px;padding: 15px;line-height: 42px"><img style="vertical-align: middle" class="img-rounded" src="{$shop.logo|getThumbImageById=30,30}"/>
            {$shop.title}</a></div>
        <ul class="c_s_nav">
            <li class="cur"><a href="{:U('store/shop/detail',array('id'=>$shop['id']))}">
                店铺首页</a></li>
            <li><a href="{:U('store/shop/goods',array('id'=>$shop['id']))}">全部商品</a></li>
        </ul>
        <div class="clearfix"></div>
    </div>
</div>
<div class="col-xs-3">
    <div class="common_block_border mb10 ">
        <h2 class="common_block_title_right">{$shop.title}</h2>

        <div class="mb10">
            <div class="c_title">


                <div class="clearfix"></div>
                <div id="tab_info" class=" col-xs-5">

                    <div class="br5  ">
                        <img class="img-rounded" src="{:getThumbImageById($shop['logo'],80,80)}"
                             style="width: 80px;height: 80px"/>
                    </div>

                    <div class="mt10"></div>

                </div>
                <div class="f12px cgrey mb10  lh16 col-xs-7">
                    访问量：{$shop.sell}人<br/>
                    总销量：{$shop.order_count}单<br/>
                    创店：{$shop.create_time|date='Y.m.d',###}
                    <br/>
                    <!--{:W('FavBtn/show',array(array('info'=>$shop)))}-->
                </div>
                <div class="col-xs-12">
                    <div class="br5 store_det f14px lh28 " style="width: 90%">
                        {$shop.summary}
                    </div>
                </div>

                <div class="clearfix"></div>

            </div>


        </div>
        <div class="clearfix"></div>

    </div>
    <div class="mr10 common_block_border mb10 ">
        <h2 class="common_block_title_right">店主信息</h2>

        <div class="clearfix mb10" style="padding-bottom: 10px;">
            <div class="col-xs-5">
                <a href="{$shop.user.space_url}" ucard="{$info.uid}"> <img class="avatar-img"
                                                                           src="{$shop.user.avatar64}"/>
                </a>
            </div>
            <div class="col-xs-5">
                <div>
                    <a href="{$shop.user.space_url}" ucard="{$shop.uid}">
                        {$shop.user.nickname}
                    </a>
                    <a class="btn btn-default btn-sm contact" onclick="talker.start_talk({$shop.uid})">在线咨询</a>
                </div>


            </div>

        </div>

    </div>

    <div class="mr10 common_block_border mb10 ">
        <h2 class="common_block_title_right">最近浏览本商品</h2>

        <div class="mt10">
            <ul class="c_read_user clearfix mb10 clearfix">
                <volist name="info.reads" id="vo">
                    <li class="mb10 col-xs-6 text-center">
                        <a class="c666"  ucard="{$vo.user.uid}"
                           href="{$vo.user.space_url}">
                            <img class="mb5 avatar-img" src="{$vo.user.avatar64}" style="width: 64px;height: 64px">

                            <div class="lh16 text-more" style="width: 75%">{$vo.user.nickname}
                            </div>

                        </a>
                    </li>
                </volist>
            </ul>

        </div>
    </div>

</div>

<div class="col-xs-9">
<div class="common_block_border mb10 ">
<h2 class="common_block_title">
    商品详情
    <div class="pull-right" style="margin-right: 14px;">
        {:W('Common/Share/detailShare')}
    </div>
</h2>
<div class="pd10">
    <div>
        <div class="col-xs-6">
            <style>
                .c_s_pics li {
                    float: left;
                }

                .fix {
                    width: 340px;
                    height: 340px;
                }

                .pic_size {
                    width: 80px !important;
                    height: 80px !important;
                    margin-right: 10px;
                    margin-bottom: 10px;
                }
            </style>

            <div class="c_s_pics">
                <div style="margin-bottom: 10px" class="clearfix">
                    <a id="jqzoomer" class="jqzoom" rel='gal1' title="细节展示"
                       href="{$info.cover_id|get_cover='path'}"><img id="jqzoomerimg" class="fix"
                                                                     src="{$info.cover_id|getThumbImageById=340,'auto'}"
                                                                     rel="{$info.cover_id|get_cover='path'}"/></a>

                </div>
            </div>

            <div class="clearfix"></div>
        </div>
        <div class="col-xs-6">
            <h1 class="f18px bld mb10"><span class="mr10">
                    {$info.title}</span>
                {:W('FavBtn/show',array(array('info'=>$info)))}</h1>

            <div class="clearfix"></div>
            <div class="f14px cgrey mb10 left lh16">
                <span  style="line-height: 25px;">
                    浏览次数：{$info.read}<br/>
                    发布日期：{$info.create_time|friendlyDate}<br/>
                    收藏：
                    <php>echo
                        D('store_fav')->where('info_id='.$info['id'])->count()
                    </php>
                </span>
                <div class="" style="margin-top: 4px;">
                    <div class="mt10 cgreen">
                        所在地：{$shop.position}<br/>
                    </div>
                    <form action="{:U('store/Index/buy')}" method="post">


                        <div class="p_number">

                            <div style="height:36px;font-size:16px;">商品单价：<strong id="price_item_1">￥{$info.price|number_format=2}</strong>
                            </div>

                            <div class="f_l add_chose">
                                <a class="reduce" onClick="setAmount.reduce('#qty_item_1')"
                                   href="javascript:void(0)">
                                    -</a>
                                <input type="text" name="qty_item_1" value="1" id="qty_item_1"
                                       onKeyUp="setAmount.modify('#qty_item_1')" class="text"/>
                                <a class="add" onClick="setAmount.add('#qty_item_1')" href="javascript:void(0)">
                                    +</a>
                            </div>

                            <div class="f_l buy">
                                总价：<span class="total-font" id="total_item_1">￥89.00</span>
                                <input type="hidden" name="total_price" id="total_price" value=""/>
                            </div>

                        </div>

                        <if condition="$info['uid'] neq $mid">
                            <a onclick="add_to_cart({$info.id},true)" class="c_btn_buy mr10 ">立即购买</a>
                            <a onclick="add_to_cart({$info.id})" class="c_btn_buy">加入购物车</a>
                            <else/>
                            此商品为您自己发布的商品，无法购买。
                        </if>
                    </form>
                    <script>
                        function add_to_cart(info_id, rightnow) {
                            $.post(U('store/Center/cart_add_item'), {good_id: info_id, count: $('#qty_item_1').val()}, function (msg) {

                                if (msg.status) {
                                    if (rightnow) {
                                        location.href = "{:U('store/Center/buy')}";
                                    }
                                    else {
                                        toast.success('添加到购物车成功。',L('_KINDLY_REMINDER_'));
                                    }
                                } else {
                                    toast.error('添加到购物车失败。', L('_KINDLY_REMINDER_'));
                                }
                            }, 'json');
                        }
                    </script>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
    </div>
    <div class="pd10">      <div>
        <a href="javascript:void(0);"
           rel="{gallery: 'gal1', smallimage:'<php>echo getThumbImageById($info['cover_id'],340,'auto')</php>',largeimage: '<php>echo get_cover($info['cover_id'],'path')</php>'}"><img
                class="pic_size"
                src="{$info.cover_id|getThumbImageById=340,340}"/></a>
        <volist name="info.gallary_images" id="g">
            <a href="javascript:void(0);"
               rel="{gallery: 'gal1', smallimage:'<php>echo getThumbImageById($g['id'],340,'auto')</php>',largeimage: '<php>echo get_cover($g['id'],'path')</php>'}"><img
                    class="pic_size"
                    src="{$g.id|getThumbImageById=340,340}"/></a>
        </volist>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#jqzoomer").jqzoom({title: false});
            });

        </script>
        <script>
            /* function set_current_pig(obj) {
             var $this = $(obj);
             var $jqzoomer = $('#jqzoomer');
             //$jqzoomer.attr('rel',$this.attr('data-url'));
             //alert($this.attr('data-url'))
             $jqzoomer.find('#jqzoomerimg').attr('src', $this.find('img').eq(0).attr('src'));
             $jqzoomer.find('#jqzoomerimg').attr('rel', $this.attr('data-url'));
             // $(".jqzoom").jqzoom();
             }*/
        </script>
    </div></div>
    <div id="detail">
        <div style="position: relative;height: 15px">
            <ul class="c_tab">
                <li id="tab_n_info" onclick="setInfo()" class="c_active cpointer">
                    详情
                </li>
                <li><span class="c333 hcblue cpointer"
                          onclick="$('html,body').animate({scrollTop: $('#c_all_com').offset().top}, 1000);">评论</span>
                </li>
            </ul>
            <if condition="check_auth('Store/Center/postEdit',$info['uid'])||check_auth('Store/Index/delInfo',$info['uid'])">
                <div class="tab_n_manage c666 " id="tab_n_manage">
                    管理
                    <div class="arrow_r c_menu"></div>
                    <ul class="right c_ddm c_menu" >
                        <if condition="check_auth('Store/Center/postEdit',$info['uid'])">
                        <li><a target="_blank"
                               href="{:U('store/center/post',array('entity_id'=>$entity['id'],'info_id'=>$info['id']))}">编辑</a>
                        </li>
                        </if>
                        <if condition="check_auth('Store/Index/delInfo',$info['uid'])">
                        <li><a class="cpointer cred" onclick="delInfo({$info['id']})">删除</a></li>
                         </if>
                    </ul>
                </div>
            </if>
            <script>
                $(document).ready(function () {
                    $('#tab_n_manage').hover(function () {
                        $('.c_menu').show();
                    }, function () {
                        $('.c_menu').hide();
                    });
                })
            </script>
        </div>
        <div class="clearfix"></div>
        <div class="underline mb10"></div>

        <div id="tab_info" class=" clearfix" style="min-height:400px">

                    <div class=" store_det f14px lh28">
                        {$info.des|render}
                    </div>

            <div class="mt10"></div>

        </div>
    </div>
</div>


<h2 class="mb10">全部评价</h2>

<div class="mb10 pd10 clearfix">
    <if condition="$info['com']['count'] eq 0">
        <div id="c_all_com" class="f18px fbld">还没有人购买后发表评价！</div>
    </if>
    <ul id="c_all_com" class="">
        <volist name="info.com.data" id="vo">
            <li class="clearfix underline pd10 ">
                <div  class="col-xs-2 text-center">
                    <a event-node="face_card" uid="{$vo.uid}" href="{$vo.user.space_url}">
                        <img src="{$vo.user.avatar64}"><br/>
                        <a ucard="{$vo.uid}"
                           href="{$vo.user.space_url}">
                            {$vo.user.nickname} </a>
                    </a>
                </div>
                <div class="col-xs-10 "  style="color:#999">
                    <div class="clearfix mb10  lh14">

                        <span class=" col-xs-5">购买于：{$vo.create_time|friendlyDate}</span>
                        <span class=" col-xs-5 "> &nbsp;&nbsp;&nbsp;评价于：{$vo.response_time_format}</span>
                        <if condition="$vo['response'] eq 1">
                            <b class="  cdeepskyblue col-xs-2 text-right" style="color: #008000">
                                好评 +1
                            </b>
                        </if>
                        <if condition="$vo['response'] eq 0">
                            <b class=" c_m_o_con cdeepskyblue col-xs-2 text-right" style="color: #808080">中评 +0</b>
                        </if>
                        <if condition="$vo['response'] eq -1">
                            <b class=" c_m_o_con cdeepskyblue col-xs-2 text-right" style="color: red">差评 -1</b>
                        </if>
                    </div>
                    <div>
                        <p class="col-xs-12 c333 lh18 ">{$vo.content|default=系统自动评价。}</p>
                    </div>
                </div>

            </li>
        </volist>
    </ul>

</div>
<section style="padding: 0 10px 20px;">
    {:hook('consult',array('table_name'=>'store_goods','row_id'=>$info['id'],'limit'=>20,'goods_uid'=>$info['uid'],'from_url'=>'store/index/info/info_id/'.$info['id'],'name'=>'微店'))}
</section>
</div>
</div>
</div>


<script>

    function setInfo() {
        $('#tab_info').show();
        $('#tab_read').hide();
        $('.c_tab li').removeClass('c_active');
        $('#tab_n_info').addClass('c_active');
    }
    function setRead() {
        $('#tab_read').show();
        $('#tab_info').hide();
        $('.c_tab li').removeClass('c_active');
        $('#tab_n_read').addClass('c_active');
    }
</script>
